<?php

class DatabaseHandler {

    // ATTRIBUTE
    // konfigurasi setting database
    public $sqlUsername     = 'root';
    public $sqlPassword     = '';
    public $sqlURL          = 'localhost';
    public $sqlDBName       = 'sifulay_db';
    // atribut koneksi dengan database
    public $sqlSelectedConn;
    public $sqlSelectedDB;
    // nama tabel yang akan digenerate
    public $t_comment           = 'comment';
    public $t_follow            = 'follow';
    public $t_foto              = 'foto';
    public $t_fotomark          = 'fotomark';
    public $t_message           = 'message';
    public $t_messagefor        = 'messagefor';
    public $t_user              = 'user';
    public $t_wall              = 'wall';
    public $t_comment_foto      = 'comment_foto';
    public $t_comment_message   = 'comment_message';
    public $t_comment_wall      = 'comment_wall';
    public $t_keyword           = 'keyword';
    public $t_foto_role         = 'foto_role';
    public $t_hak_komentar_foto = 'hak_komentar_foto';
    public $t_blocked_user      = 'blocked_user';
    public $t_chat              = 'chat';
    public $t_chatfor           = 'chatfor';
    public $t_chatreceived      = 'chatreceived';
    public $t_foto_tag          = 'foto_tag';
    public $t_notif             = 'notif';

    // METHOD
    // konstruktor
    public function __construct() {
        $this->sqlSelectedConn = mysql_connect($this->sqlURL, $this->sqlUsername, $this->sqlPassword) or die("Can't Connect Database");
        if ($this->sqlSelectedConn) {
            $this->sqlSelectedDB = mysql_select_db($this->sqlDBName, $this->sqlSelectedConn) or die("Can't Select Database");
            if ($this->sqlSelectedDB) {
                // berhasil konek
            }
        }
    }

    // generate query
    public function execQuery($query) {
        return mysql_query($query);
    }

}

?>
